shell脚本批量调用git命令

有时候想对本地的几个repository都进行一下pull,一个一个操作比较繁琐,所以写了个shell脚本进行简化操作。

  1. git_pull_all.sh

     #!/bin/sh
     clear
     
     function showMsg()
     {
       echo -e "\033[32m$1\033[0m"
     }
     
     lstRepo=(
       Project01
       Project02
       Project03
       Project04
     )
     for repo in ${lstRepo[@]}
     do
       cd ../$repo
       showMsg '开始git pull '$repo
       git pull
     done
    
  2. start_pull.sh

     #!/bin/sh
     clear
     
     ./git_pull_all.sh
     
     echo
     echo
     echo
     echo
     echo -e "\033[32m=====================================\033[0m"
     echo -e "\033[32mPress any key to exit \033[0m"
     echo -e "\033[32m=====================================\033[0m"
     read
    
posted @ 2015-10-21 20:12  liqipeng  阅读(5853)  评论(0编辑  收藏  举报